package com.it.xuehang.controller;


import com.it.xuehang.entity.ResourceCategory;
import com.it.xuehang.service.ResourceCategoryService;
import com.it.xuehang.util.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 资源类别。物资，装备，队伍，避难场所，防护目标等 前端控制器
 * </p>
 *
 * @author xuehang
 * @since 2024-12-10
 */
@RestController
@RequestMapping("/resourceCategory")
public class ResourceCategoryController {
    @Autowired
    private ResourceCategoryService resourceCategoryService;

    /**
     * 查询父级及其所有递归的下级类别数据。
     *
     * @param rescateId 资源类别编码
     * @return 包含父级和所有子类别的列表
     */
    @GetMapping("/rescateId")
    public ResponseResult<List<ResourceCategory>> getCategoriesAndSubcategories(String rescateId) {
        return new ResponseResult<>(200,
                resourceCategoryService.getCategoriesAndSubcategories(rescateId));
    }

}
